-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
customerId is returned in Purchase API handler #83
base: master
Are you sure you want to change the base?
customerId is returned in Purchase API handler #83
Conversation
…dled and also in view files cleared SwiftLint warning issues
@@ -12,7 +12,7 @@ public class CBPurchase: NSObject { | |||
public static let shared = CBPurchase() | |||
private var productIDs: [String] = [] | |||
public var receiveProductsHandler: ((_ result: Result<[CBProduct], CBPurchaseError>) -> Void)? | |||
public var buyProductHandler: ((Result<(status:Bool, subscriptionId:String?, planId:String?), Error>) -> Void)? | |||
public var buyProductHandler: ((Result<(status: Bool, subscriptionId: String?, planId: String?, customerId: String?), Error>) -> Void)? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this be a breaking change. Is there anything we can do to reduce the impact?
Also would prefer this tuple be a type/alias instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this be a breaking change. Is there anything we can do to reduce the impact? Also would prefer this tuple be a type/alias instead.
Updated with struct
SonarCloud Quality Gate failed. 0 Bugs No Coverage information Catch issues before they fail your Quality Gate with our IDE extension SonarLint |
@@ -12,7 +12,7 @@ public class CBPurchase: NSObject { | |||
public static let shared = CBPurchase() | |||
private var productIDs: [String] = [] | |||
public var receiveProductsHandler: ((_ result: Result<[CBProduct], CBPurchaseError>) -> Void)? | |||
public var buyProductHandler: ((Result<(status:Bool, subscriptionId:String?, planId:String?), Error>) -> Void)? | |||
private var buyProductHandler: ((Result<PurchaseSubscription, Error>) -> Void)? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be just Subscription
?
@available(*, deprecated, message: "This will be removed in upcoming versions, Please use this API func purchaseProduct(product: CBProduct, customer : CBCustomer? = nil, completion)") | ||
func purchaseProduct(product: CBProduct, customerId : String? = "",completion handler: @escaping ((_ result: Result<(status:Bool, subscriptionId:String?, planId:String?), Error>) -> Void)) { | ||
func purchaseProduct(product: CBProduct, customerId: String? = "", completion handler: @escaping ((_ result: Result<PurchaseSubscription, Error>) -> Void)) { | ||
buyProductHandler = handler |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove this from the major version.
// MARK: - Subscription | ||
public struct PurchaseSubscription: Decodable { | ||
public let status: Bool | ||
public let subscriptionDetails: CBValidateReceipt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason that we want to have subscriptionDetails
here? IMO this struct is related to subscription and any details can be here itself. Check with NonSubscription
Improvements :